<?php
	define('_JEXEC', 1);
	ob_start();
	session_start();
	function __autoload($class_name)
	{
		require_once "classes/" . $class_name . ".php";
	}
	
	include_once "functions.php";
	session_start();
	
	$nhatky = new nhatkybs();
	$nhatky->TenSuKien = "Đăng xuất hệ thống";
	if(isset($_SESSION["MaND"]))
		$nhatky->MaNguoiDung = $_SESSION["MaND"];
	else
		$nhatky->MaNguoiDung = $_SESSION["MaKH"];
	date_default_timezone_set('Asia/Ho_Chi_Minh');
	$nhatky->ThoiGian = date("Y-m-d H:m:s", time());
	$nhatky->Them();
	// Hủy SESSION
	unset($_SESSION['TenND']);
	unset($_SESSION['MaND']);
	unset($_SESSION['MaKH']);
	unset($_SESSION['MaQuyen']);
	// Chuyển hướng về trang chủ
	
	header("Location: index.php");
?>